package com.glut.gultguy.controller;


import com.glut.gultguy.To.GoodsAuctionRecordTo;
import com.glut.gultguy.entity.GoodsAuctionRecord;
import com.glut.gultguy.mapper.GoodsAuctionRecordMapper;
import com.glut.gultguy.service.GoodsAuctionRecordService;
import com.glut.gultguy.vo.GoodsAuctionRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-09-05
 */
@RestController
@RequestMapping("/goodsAuctionRecord")
public class GoodsAuctionRecordController {


    @Autowired(required = false)
    private GoodsAuctionRecordMapper mapper;

    @Autowired
    private GoodsAuctionRecordService service;

    @PostMapping("/set")
    @ResponseBody
    public Map<String,Integer> setGoodsAuction(@RequestBody GoodsAuctionRecordTo goodsAuctionRecordTo){
    return service.setGoodsRecord(goodsAuctionRecordTo);

    }

    @GetMapping("/get/{id}")
    @ResponseBody
    public List<GoodsAuctionRecordVo> getGoodsAuctionList(@PathVariable("id") String goodsID){
        return service.getRecordList(goodsID);
    }
    @GetMapping("/getUserRecord/{id}")
    public List<GoodsAuctionRecord> getUserRecord(@PathVariable("id") String openId){
        return mapper.getUserRrcord(openId);
    }

}

